===============================================================================
Where are the files:
===============================================================================

"src" folder contains all the source code written in R
"data" folder contains all the data stored in an excel file
"screenshots" folder contains all the sample screenshots


===============================================================================
Regarding the dataset:
===============================================================================

"Dataset" excel file contains all the datasets used in the experiments with each sheet one dataset and the description in sheet name.


===============================================================================
Regarding the code:
===============================================================================

"program.R" file includes the source code of the main program, which includes robust multivariate estimators, a simple implementation of linear spatial scan menthod and Mente Carlo simulation using bootstrap resampling. The program is implemented in R. While "Synthetic data comparison.R" file contains the source code for generating synthetic data with continuous or discrete distribution, and useful data visulization.


===============================================================================
Regarding the running environment:
===============================================================================

You will need to install R (http://www.r-project.org/) to use the above code. R is available for Windows, Linux, and MacOS X.


===============================================================================
Regarding how to run experiments:
===============================================================================

First open R main program that being installed above, then load any of the two files that contain R source code from R main console, which are "Multivariate anomalous window detection.R" and "Synthetic data comparison.R". Users will see a window with all the R source code, and can then click "Edit" -> "Run all" to execute the source directly, no compilation is needed. Below are the instructions for how to run experiments using our R code. Screenshot1.png shows the screenshots of the setup.

In "Multivariate anomalous window detection.R", please copy the dataset in "Dataset" excel file without the first column (either milepost or location name) to a plain text file and supply the path of the file to the code (replace where you see "your code"). The program will print the following useful results on console by order: the obtained robust mahalanobis distance, and non-robust mahalanobis distance for comparison, the start and end index of anomalous window (please not there will be cases where the length of the printed window is larger then 1/2 of the total window, then the counter part is the actual anomalous window), likelihood ratio of the anomalous window, likelihood ratio of each anomalous window identified in monte carlo simulation, and final p-value. Note these results could change in different runs of the program since they all include certain randomization. Screenshot2.png shows the screenshots of the running program. 

In "Synthetic data comparison.R", an additional visulization of the mahalanobis distance will also be shown, the data are randomly generated based on the multivariate distributions set in the source code. Users can change the mean or covariance of the distribution freely or use different distributions. Screenshot3.png shows the screenshots of the running program.


=================================================================================================
Other spatial scan menthods that can be used together with this multivariate scan statistics:
=================================================================================================

There are other more powerful spatial scan statistics menthods that can be potentially used together with this robust nonparametric multivariate scan statistics for detecting multivariate anomalous windows, which include:

1. Anomalous window discovery through scan statistics for linear intersecting paths,
The 15th ACM SIGKDD international conference on Knowledge discovery and data mining (KDD09), Paris, FranceJune 28, 2009
Authors: Lei Shi, V.P. Janeja

2. Anomalous Window Discovery for Linear Intersecting Paths,
IEEE Transactions on Knowledge and Data Engineering 23(12): 1857-1871 (2011)
Authors: Lei Shi, V.P. Janeja


